﻿Imports System

Namespace System.Workflow.ComponentModel
    <Serializable> _
    Friend NotInheritable Class ActivityExecutionContextInfo
        ' Methods
        Friend Sub New(ByVal qualifiedName As String, ByVal contextId As Integer, ByVal contextGuid As Guid, ByVal parentContextId As Integer)
            Me.qualifiedID = qualifiedName
            Me.contextId = contextId
            Me.contextGuid = contextGuid
            Me.parentContextId = parentContextId
        End Sub

        Public Overrides Function Equals(ByVal obj As Object) As Boolean
            Dim info As ActivityExecutionContextInfo = [TryCast](obj,ActivityExecutionContextInfo)
            Return ((Not info Is Nothing) AndAlso Me.ContextGuid.Equals(info.ContextGuid))
        End Function

        Public Overrides Function GetHashCode() As Integer
            Return Me.contextGuid.GetHashCode
        End Function

        Friend Sub SetCompletedOrderId(ByVal completedOrderId As Integer)
            Me.completedOrderId = completedOrderId
        End Sub


        ' Properties
        Public ReadOnly Property ActivityQualifiedName As String
            Get
                Return Me.qualifiedID
            End Get
        End Property

        Public ReadOnly Property CompletedOrderId As Integer
            Get
                Return Me.completedOrderId
            End Get
        End Property

        Public ReadOnly Property ContextGuid As Guid
            Get
                Return Me.contextGuid
            End Get
        End Property

        Friend ReadOnly Property ContextId As Integer
            Get
                Return Me.contextId
            End Get
        End Property

        Friend Property Flags As PersistFlags
            Get
                Return Me.flags
            End Get
            Set(ByVal value As PersistFlags)
                Me.flags = value
            End Set
        End Property

        Friend ReadOnly Property ParentContextId As Integer
            Get
                Return Me.parentContextId
            End Get
        End Property


        ' Fields
        Private completedOrderId As Integer = -1
        Private contextGuid As Guid = Guid.Empty
        Private contextId As Integer = -1
        Private flags As PersistFlags
        Private parentContextId As Integer = -1
        Private qualifiedID As String = String.Empty
    End Class
End Namespace

